import { BasicColumn, FormSchema } from '@/components/Table';

export const columns: BasicColumn[] = [
  {
    title: '资源名称',
    dataIndex: 'name',
    width: 120,
  },
  {
    title: '资源类型',
    dataIndex: 'type',
    width: 120,
  },
  {
    title: '资源路径',
    dataIndex: 'url',
    width: 200,
    align: 'left',
  },
  {
    title: '创建时间',
    dataIndex: 'created_at',
    width: 180,
  },
  {
    title: '更新时间',
    dataIndex: 'updated_at',
    width: 180,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'name',
    label: '资源名称',
    component: 'Input',
    colProps: { span: 8 },
  },
  {
    field: 'type',
    label: '资源类型',
    component: 'Select',
    componentProps: {
      options: [
        { label: 'css(样式)', value: 'css' },
        { label: 'js(JavaScript)', value: 'js' },
        { label: 'image(图片)', value: 'image' },
      ],
    },
    colProps: { span: 8 },
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'name',
    label: '资源名称',
    component: 'Input',
    required: false,
    colProps: { span: 24 },
  },
  {
    field: 'type',
    label: '资源类型',
    component: 'Select',
    componentProps: {
      options: [
        { label: 'css(样式)', value: 'css' },
        { label: 'js(JavaScript)', value: 'js' },
        { label: 'image(图片)', value: 'image' },
      ],
    },
    required: true,
    colProps: { span: 24 },
  },
  {
    field: 'file',
    label: '上传文件',
    component: 'Upload',
    required: true,
    colProps: { span: 24 },
  },
];
